from rest_framework.viewsets import ModelViewSet
from goods.models import GoodsChannel,GoodsChannelGroup, GoodsCategory
from meiduo_admin.my_paginate import MyPageNumberPagination
from meiduo_admin.good import channel_serializers
from rest_framework.generics import ListAPIView

class ChannelViewSet(ModelViewSet):
    pagination_class=MyPageNumberPagination
    serializer_class = channel_serializers.channelViewSetSerializer
    queryset = GoodsChannel.objects.all()

class ChannelTypesViewSet(ListAPIView):

    serializer_class = channel_serializers.ChannelTypesViewSetSerializer
    queryset = GoodsChannelGroup.objects.all()

class CategoriesViewSet(ListAPIView):

    serializer_class = channel_serializers.CategoriesViewSetSerializer
    queryset = GoodsCategory.objects.filter(parent=None).all()
